home *** CD-ROM | disk | FTP | other *** search
/ Amnesia 8 / Amnesia - Issue 08 (1992-05-31)(Eclipse).adf / text / macro < prev   
Text File  |  1992-05-31  |  8KB  |  443 lines

  1. *************************************************
  2. * Set of custom macros by Wild Thing Of Cryptic *
  3. *                        *
  4. * Added a few More Macros - Gazzer/Eclipse      *
  5. *************************************************
  6.  
  7. ; Case pendancy off
  8.  
  9.     Opt    c-,d-
  10.     
  11. ; Hardware registers first
  12.  
  13. custom   equ $dff000
  14. bltddat  equ $000
  15. dmaconr  equ $002
  16. vposr    equ $004
  17. vhposr   equ $006
  18. dskdatr  equ $009
  19. joy0dat  equ $00a
  20. joy1dat  equ $00c
  21. clxdat   equ $00e
  22. adkconr  equ $010
  23. pot0dat  equ $012
  24. pot1dat  equ $014
  25. potgor   equ $016
  26. serdatr  equ $018
  27. dskbytr  equ $01a
  28. intenar  equ $01c
  29. intreqr  equ $01e
  30. dskpth   equ $020
  31. dskptl   equ $022
  32. dsklen   equ $024
  33. dskdat   equ $026
  34. refptr   equ $028
  35. vposw    equ $02a
  36. vhposw   equ $02c
  37. copcon   equ $02e
  38. serdat   equ $030
  39. serper   equ $032
  40. potgo    equ $034
  41. joytest  equ $036
  42. strequ   equ $038
  43. strvbl   equ $03a
  44. strhor   equ $03c
  45. strlong  equ $03e
  46. bltcon0  equ $040
  47. bltcon1  equ $042
  48. bltafwm  equ $044
  49. bltalwm  equ $046
  50. bltcpth  equ $048
  51. bltcptl  equ $04a
  52. bltbpth  equ $04c
  53. bltbptl  equ $04e
  54. bltapth  equ $050
  55. bltaptl  equ $052
  56. bltdpth  equ $054
  57. bltdptl  equ $056
  58. bltsize  equ $058
  59. bltcmod  equ $060
  60. bltbmod  equ $062
  61. bltamod  equ $064
  62. bltdmod  equ $066
  63. bltcdat  equ $070
  64. bltbdat  equ $072
  65. bltadat  equ $074
  66. dsksync  equ $07e
  67. cop1lch  equ $080
  68. cop1lcl  equ $082
  69. cop2lch  equ $084
  70. cop2lcl  equ $086
  71. copjmp1  equ $088
  72. copjmp2  equ $08a
  73. copins   equ $08c
  74. diwstrt  equ $08e
  75. diwstop  equ $090
  76. ddfstrt  equ $092
  77. ddfstop  equ $094
  78. dmacon   equ $096
  79. clxcon   equ $098
  80. intena   equ $09a
  81. intreq   equ $09c
  82. adkcon   equ $09e
  83. aud0lch  equ $0a0
  84. aud0lcl  equ $0a2
  85. aud0len  equ $0a4
  86. aud0per  equ $0a6
  87. aud0vol  equ $0a8
  88. aud0dat  equ $0aa
  89. aud1lch  equ $0b0
  90. audilcl  equ $0b2
  91. aud1len  equ $0b4
  92. aud1per  equ $0b6
  93. aud1vol  equ $0b8
  94. aud1dat  equ $0ba
  95. aud2lch  equ $0c0
  96. aud2lcl  equ $0c2
  97. aud2len  equ $0c4
  98. aud2per  equ $0c6
  99. aud2vol  equ $0c8
  100. aud2dat  equ $0ca
  101. aud3lch  equ $0d0
  102. aud3lcl  equ $0d2
  103. aud3len  equ $0d4
  104. aud3per  equ $0d6
  105. aud3vol  equ $0d8
  106. aud3dat  equ $0da
  107. bpl1pth  equ $0e0
  108. bpl1ptl  equ $0e2
  109. bpl2pth  equ $0e4
  110. bpl2ptl  equ $0e6
  111. bpl3pth  equ $0e8
  112. bpl3ptl  equ $0ea
  113. bpl4pth  equ $0ec
  114. bpl4ptl  equ $0ee
  115. bpl5pth  equ $0f0
  116. bpl5ptl  equ $0f2
  117. bpl6pth  equ $0f4
  118. bpl6ptl  equ $0f6
  119. bplcon0  equ $100
  120. bplcon1  equ $102
  121. bplcon2  equ $104
  122. bpl1mod  equ $108
  123. bpl2mod  equ $10a
  124. bpl1dat  equ $110
  125. bpl2dat  equ $112
  126. bpl3dat  equ $114
  127. bpl4dat  equ $116
  128. bpl5dat  equ $118
  129. bpl6dat  equ $11a
  130. spr0pth  equ $120
  131. spr0ptl  equ $122
  132. spr1pth  equ $124
  133. spr1ptl  equ $126
  134. spr2pth  equ $128
  135. spr2ptl  equ $12a
  136. spr3pth  equ $12c
  137. spr3ptl  equ $12e
  138. spr4pth  equ $130
  139. spr4ptl  equ $132
  140. spr5pth  equ $134
  141. spr5ptl  equ $136
  142. spr6pth  equ $138
  143. spr6ptl  equ $13a
  144. spr7pth  equ $13c
  145. spr7ptl  equ $13e
  146. spr0pos  equ $140
  147. spr0ctl  equ $142
  148. spr0data equ $144
  149. spr0datb equ $146
  150. spr1pos  equ $148
  151. spr1ctl  equ $14a
  152. spr1data equ $14c
  153. spr1datb equ $14e
  154. spr2pos  equ $150
  155. spr2ctl  equ $152
  156. spr2data equ $154
  157. spr2datb equ $156
  158. spr3pos  equ $158
  159. spr3ctl  equ $15a
  160. spr3data equ $15c
  161. spr3datb equ $15e
  162. spr4pos  equ $160
  163. spr4ctl  equ $162
  164. spr4data equ $164
  165. spr4datb equ $166
  166. spr5pos  equ $168
  167. spr5ctl  equ $16a
  168. spr5data equ $16c
  169. spr5datb equ $16e
  170. spr6pos  equ $170
  171. spr6ctl  equ $172
  172. spr6data equ $174
  173. spr6datb equ $176
  174. spr7pos  equ $178
  175. spr7ctl  equ $17a
  176. spr7data equ $17c
  177. spr7datb equ $17e
  178. color00  equ $180
  179. color01  equ $182
  180. color02  equ $184
  181. color03  equ $186
  182. color04  equ $188
  183. color05  equ $18a
  184. color06  equ $18c
  185. color07  equ $18e
  186. color08  equ $190
  187. color09  equ $192
  188. color10  equ $194
  189. color11  equ $196
  190. color12  equ $198
  191. color13  equ $19a
  192. color14  equ $19c
  193. color15  equ $19e
  194. color16  equ $1a0
  195. color17  equ $1a2
  196. color18  equ $1a4
  197. color19  equ $1a6
  198. color20  equ $1a8
  199. color21  equ $1aa
  200. color22  equ $1ac
  201. color23  equ $1ae
  202. color24  equ $1b0
  203. color25  equ $1b2
  204. color26  equ $1b4
  205. color27  equ $1b6
  206. color28  equ $1b8
  207. color29  equ $1ba
  208. color30  equ $1bc
  209. color31  equ $1be
  210. tbe      equ 0
  211. dskblk   equ 1
  212. soft     equ 2
  213. ports    equ 3
  214. coper    equ 4
  215. vertb    equ 5
  216. blit     equ 6
  217. aud0     equ 7
  218. aud1     equ 8
  219. aud2     equ 9
  220. aud3     equ 10
  221. rbf      equ 11
  222. dsksyn   equ 12
  223. exter    equ 13
  224. inten    equ 14
  225. ciaa     equ $bfe001
  226. ciab     equ $bfd000
  227. pra      equ $000
  228. prb      equ $100
  229. ddra     equ $200
  230. ddrb     equ $300
  231. talo     equ $400
  232. tahi     equ $500
  233. tblo     equ $600
  234. tbhi     equ $700
  235. event    equ $800
  236. sdr      equ $c00
  237. icr      equ $d00
  238. cra      equ $e00
  239. crb      equ $f00
  240. ovl      equ 0
  241. led      equ 1
  242. chng     equ 2
  243. wrpo     equ 3
  244. tk0      equ 4
  245. rdy      equ 5
  246. fir0     equ 6
  247. fir1     equ 7
  248. busy     equ 0
  249. pout     equ 1
  250. sel      equ 2
  251. dsr      equ 3
  252. cts      equ 4
  253. cd       equ 5
  254. rts      equ 6
  255. dtr      equ 7
  256. step     equ 0
  257. dir      equ 1
  258. side     equ 2
  259. sel0     equ 3
  260. sel1     equ 4
  261. sel2     equ 5
  262. sel3     equ 6
  263. mtr      equ 7
  264. MEMF_CHIP    EQU    1<<1        ;together produces this :
  265. MEMF_CLEAR    EQU    1<<16        ;      $10002=65538
  266. MEMORY        EQU    MEMF_CHIP+MEMF_CLEAR    ;allocates chip ram and clears it
  267. EXECBASE    EQU    4
  268. ALLOCMEM    EQU    -198
  269. FREEMEM        EQU    -210
  270.  
  271. ; Now lets get down with some copper macros
  272.  
  273. Spr_Off    Macro
  274.     DC.W    $120,0
  275.     DC.W    $122,0
  276.     DC.W    $124,0
  277.     DC.W    $126,0
  278.     DC.W    $128,0
  279.     DC.W    $12A,0
  280.     DC.W    $12C,0
  281.     DC.W    $12E,0
  282.     DC.W    $130,0
  283.     DC.W    $132,0
  284.     DC.W    $134,0
  285.     DC.W    $136,0
  286.     DC.W    $138,0
  287.     DC.W    $13A,0
  288.     DC.W    $13C,0
  289.     DC.W    $13E,0
  290.     Endm
  291.  
  292. ; Macro to Do a copper Bar - Change Colour! Currently $dff180..
  293.  
  294. Bar0    Macro
  295.     Dc.b     \1,$09,$FF,$FE
  296.     Dc.w     COLOR00,\2
  297.     Endm
  298.  
  299. Bar1    Macro
  300.     Dc.b     \1,$09,$FF,$FE
  301.     Dc.w     COLOR01,\2
  302.     Endm
  303.  
  304. ; Macro to wait for scan line x,y
  305.  
  306. Cwait    Macro
  307.     Dc.b    \1,\2+9,$ff,$fe
  308.     Endm
  309.  
  310. Cskip    Macro
  311.     Dc.b    \1,\2+9,$ff,$ff
  312.     Endm
  313.  
  314. ; Move a value into the relevant hardwar register
  315.  
  316. Cmove    Macro
  317.     dc.w    \2,\1
  318.     Endm
  319.  
  320. ; Easy way to enable pal area in copper
  321.  
  322. Pal    Macro
  323.     Dc.w    $ff09,$fffe,$ffdd,$fffe
  324.     Endm
  325.  
  326. ; Terminate copper
  327.  
  328. Endcop    Macro
  329.     Dc.w    $ffff,$fffe
  330.     Endm
  331.     
  332. ; Now lets get down with some blitter macros
  333.  
  334. BlitWait Macro
  335. BlitW\@    Btst    #6,$dff002
  336.     Bne.s    BlitW\@
  337.     Endm
  338.  
  339. ; Now a macro to section code the easy way
  340.  
  341. Chip    Macro
  342.     Section    Gazzer,Code_c
  343.     Endm
  344.     
  345. ; Macro to wait for lft mse button
  346.  
  347. tstmice MACRO
  348.     Btst    #6,$Bfe001
  349.     Bne    \1
  350.     Endm
  351.  
  352. ; Macro to save and restore rege
  353.  
  354. Saveall    Macro
  355.     Movem.l    d0-d7/a0-a6,-(A7)
  356.     endm
  357.  
  358. LoadAll    Macro
  359.     Movem.l    (a7)+,d0-d7/a0-a6
  360.     Endm
  361.  
  362. Planeon    Macro
  363.     Move.w    \1,\2
  364.     Swap    \1
  365.     Move.w    \1,\3
  366.     Swap    \1
  367.     Endm
  368. POS    Macro
  369. Posi\@
  370.     cmp.b    #$ff,$dff006
  371.     bne.s    Posi\@
  372.     ENDM
  373.  
  374. ; Macro to kill the OS
  375.  
  376. Kill    Macro
  377.     move.l    4,a6
  378.     jsr    -132(a6)
  379.     Move.l    4,A6            ; Get execbase
  380.     lea    graf,a1
  381.     moveq.l    #0,d0
  382.     jsr    -552(a6)
  383.     move.l    d0,a6
  384.     move.l    $26(a6),oldcop
  385.     move.l    $32(a6),oldcop1
  386.     Lea    Custom,A6        ; Load custom into a6
  387.     Move.w    Intenar(a6),IrqSt    ; Store interupt status
  388.     Move.w    Dmaconr(A6),DMAst    ; Stor DMA startus
  389.     Move.w    #$7fff,Intena(a6)    ; Clear all interupts, except keys
  390.     Move.w    #$7fff,Dmacon(a6)    ; Clear all DMA channels
  391.     Move.l    $68,Vblank1        ; Store old lev 2 
  392.     Move.l    $6c,Vblank        ; Store old lev 3
  393.     Move.w    #%1000011111010000,Dmacon(a6)    
  394.     Bra.s    Leviva
  395.  
  396. Graf:    dc.b    "graphics.library",0
  397.  even
  398. OldCop:    Dc.l    0
  399. OldCop1:Dc.l    0
  400. Vblank:    Dc.l    0
  401. Vblank1:Dc.l    0
  402. IrqSt:    Dc.w    0
  403. DMAst:    Dc.w    0
  404. Leviva:
  405.     Endm
  406.  
  407. ; Macro to bring OS back to life
  408.  
  409. Heal    Macro
  410.     move.l    4,a6
  411.     jsr    -138(a6)
  412.     Lea    Custom,a6        ; Get custom base
  413.     Move.l    Vblank1,$68        ; Restore lev 2
  414.     Move.l    Vblank,$6c        ; Restore lev 3
  415.     Move.l    OldCop,Cop1lch(a6)    ; Restore Copper
  416.     Move.l    OldCop1,Cop2lch(a6)    ; Restore Copper
  417.     Move.w    IrqSt,d0        ; Get old interupt status
  418.     Or    #$c000,d0
  419.     Move.w    d0,Intena(a6)        ; Set em up again
  420.     Move.w    DMAst,d0        ; Get old DMA status
  421.     Or    #$8100,d0
  422.     Move.w    d0,Dmacon(a6)        ; Set Em Up
  423.     Endm
  424.  
  425. ALLOC    MACRO
  426.     MOVE.L    EXECBASE,A6
  427.     MOVE.L    #\1,D0
  428.     MOVE.L    #\2,D1
  429.     JSR    ALLOCMEM(A6)
  430.     MOVE.L    D0,\3
  431.     ENDM
  432.  
  433. FREE    MACRO
  434.     MOVE.L    EXECBASE,A6
  435.     MOVE.L    \1,A1
  436.     MOVE.L    #\2,D0
  437.     JSR    FREEMEM(A6)
  438.     ENDM
  439.  
  440. ; e.g.    ALLOC    12880,MEMORY,BOBSPACE        ;368x140 2 planes
  441. ; e.g.    FREE    BOBSPACE,12880
  442.  
  443.